/*
 *    Copyright (C) 2011-2012 Hai Bison
 *
 *    See the file LICENSE at the root directory of this project for copying
 *    permission.
 */

package group.pals.mailgate.ui;

import group.pals.utils.ui.JEditorPopupMenu;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;

/**
 *
 * @author Hai Bison
 */
public class Utils {

    private Utils() {
    }

    public static Utils getInstance() {
        return UtilsHolder.INSTANCE;
    }

    private static class UtilsHolder {

        private static final Utils INSTANCE = new Utils();
    }
    /*----------------------------------------------------------------------------
     * UTILITIES
     */
    private JEditorPopupMenu editorPopupMenu;

    public JEditorPopupMenu getEditorPopupMenu() {
        if (editorPopupMenu == null) {
            editorPopupMenu = new JEditorPopupMenu();
        }
        return editorPopupMenu;
    }

    public Rectangle getDesktopSize() {
        Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        Rectangle maximumWindowBounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
        return new Rectangle(maximumWindowBounds.x, maximumWindowBounds.y,
                Math.min(screenSize.width, maximumWindowBounds.width),
                Math.min(screenSize.height, maximumWindowBounds.height));
    }
}
